/***************************************************************************
 *   Copyleft 2006-2007 by												   *
 *	 Iwanicki Krzysztof													   *
 *   <gamma.mini.pw.edu.pl/~iwanickik>									   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 ***************************************************************************/
#ifndef __SCENE3D_H__
#define __SCENE3D_H__

#include <list>
#include "../../Types/Types.h"
#include "../Objects/Object3D.h"
#include "../Objects/Cursor3D/Cursor3D.h"
#include "../Renderer/Renderer.h"
#include "../Renderer/ProjectionPlane.h"

typedef std::list<Object3D*> ObjectsList;
typedef std::list<Object3D*>::iterator ObjectsListIt;

class Scene3D {
private:
	Cursor3D* mCursor;
	ObjectsList mObjects;
	Matrix4D mWorldMatrix;

public:

    /**************************************************************
    * Constructors                                                *
    ***************************************************************/
    Scene3D();
    ~Scene3D(); 
        
    /**************************************************************
    * Operators                                                   *
    ***************************************************************/


    /**************************************************************
    * Other helpful functions                                     *
    ***************************************************************/
	cVoid Render(Renderer& renderer, Matrix4D& projectionMatrix, ProjectionPlane& plane);
	cVoid Render(Renderer& renderer, Matrix4D& projectionMatrix, ProjectionPlane& plane, cWinColor color);
	cVoid RenderCursor(Renderer& renderer, Matrix4D& projectionMatrix, ProjectionPlane& plane);
	cVoid RenderCursor(Renderer& renderer, Matrix4D& projectionMatrix, ProjectionPlane& plane, cWinColor color);

	cVoid AddCursor(Cursor3D* cursor);
	Cursor3D* GetCursor();

	cVoid AddObject(Object3D* object);
	cVoid RemoveObject(Object3D* object);
	cVoid RemoveObject(Object3D* object, cBool bDelete);
	Object3D* ReplaceObject(Object3D* oldObject, Object3D* newObject);
	Object3D* GetObject(cInt iIndex);
	Object3D* GetObjectByID(cInt iIndex);
	ObjectsList& GetObjects();
	cInt GetNrOfObjects();

	Matrix4D& GetWorldMatrix();
	cVoid SetWorldMatrix(Matrix4D& matrix);
	cVoid Transform(Matrix4D& matrix);
	cVoid Reset();
	
};                                                                 

#endif // __SCENE3D_H__